home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 1063 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Interpretation Sought for DWP Concept of 'Valid Object'
  5. Date: 12 Apr 1996 12:12:50 PDT
  6. Organization: Comp Sci, University of Melbourne
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4km9i2$hsm@mulga.cs.mu.OZ.AU>
  9. References: <4kltuk$73j@bmtlh10.bnr.ca>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 12 Apr 1996 19:05:38 GMT
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBVAwUBMW6rNEy4NqrwXLNJAQHESgIAnJNA4PSZA3ch7bvd4g+qlQFKzyXuia4f
  14.     gHDGfmNkfNetX4SjWYA7KIW7qrzEq1KOZlUDpdClpTovMPVtRt9eog==
  15.     =pdHG
  16. Originator: austern@isolde.mti.sgi.com
  17.  
  18. "john (j.d.) hickin" <hickin@bnr.ca> writes:
  19.  
  20. >A recent thread in another newsgroup has aroused some interest.  Lately there
  21. >has been a small debate around the interpretation of the following phrase,
  22. >ostensibly taken from the DWP:
  23. >
  24. >    A reference shall be initialized to refer to a valid object or function.
  25.  
  26. The January 96 WP doesn't contain those words, or at least I couldn't spot
  27. them.  It says instead
  28.  
  29. |   8.5.3  References                                       [dcl.init.ref]
  30. | 1 A  variable  declared  to  be  a  T&,  that  is  "reference to type T"
  31. |   (_dcl.ref_), shall be initialized by an object, or function, of type T
  32. |   or by an object that can be converted into a T.  [Example:
  33. |           int g(int);
  34. |           void f()
  35. |           {
  36. |               int i;
  37. |               int& r = i;  // `r' refers to `i'
  38.  
  39. This is straight out of ARM 8.4.3 (the only change is that "must" has
  40. been replaced with "shall"), so it hasn't changed for a long time.
  41.  
  42. >One party claims that valid object means initialized object while another
  43. >claims that all is required is that the object have a valid address.
  44. >
  45. >Does the DWP make it clear which interpretation should be used?
  46.  
  47. Yes: the latter interpretation is correct.  It is OK to initialize
  48. a reference to refer to an uninitialized object, as in the example above.
  49.  
  50. --
  51. Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
  52. WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
  53. PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
  54. ---
  55. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  56.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  57.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  58.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  59.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  60. ]
  61.